<template>
  <div class="mod-crm__crmexhibition">
    <el-form :inline="true" :model="state.dataForm" @keyup.enter="state.getDataList()">
      <el-form-item>
        <el-input v-model="state.dataForm.exhName" placeholder="展会名称" clearable></el-input>
      </el-form-item>
      <el-form-item>
        <el-input v-model="state.dataForm.exhBTime" placeholder="开始时间" clearable></el-input>
      </el-form-item>
      <el-form-item>
        <el-input v-model="state.dataForm.exhETime" placeholder="结束时间" clearable></el-input>
      </el-form-item>
      <el-form-item>
        <el-input v-model="state.dataForm.exhCity" placeholder="城市" clearable></el-input>
      </el-form-item>
      <el-form-item>
        <el-button @click="state.getDataList()">{{ $t("query") }}</el-button>
      </el-form-item>
      <el-form-item>
        <el-button type="info" @click="state.exportHandle()">{{ $t("export") }}</el-button>
      </el-form-item>
      <el-form-item>
        <el-button v-if="state.hasPermission('crm:crmexhibition:save')" type="primary" @click="addOrUpdateHandle()">{{ $t("add") }}</el-button>
      </el-form-item>
      <el-form-item>
        <el-button v-if="state.hasPermission('crm:crmexhibition:delete')" type="danger" @click="state.deleteHandle()">{{ $t("deleteBatch") }}</el-button>
      </el-form-item>
    </el-form>
    <el-table v-loading="state.dataListLoading" :data="state.dataList" border @selection-change="state.dataListSelectionChangeHandle" style="width: 100%">
      <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
      <el-table-column prop="exhCode" label="code" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exbManagerId" label="managerid" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhType" label="type" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhIfCompany" label="ifcompany" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhGroup" label="group" header-align="center" align="center"></el-table-column>
      <el-table-column prop="qtrId" label="qtrid" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhName" label="展会名称" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhIfConfirm" label="是否确定" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhBTime" label="开始时间" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhETime" label="结束时间" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhCity" label="城市" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhEhcId" label="场馆id" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhScope" label="展品范围" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhTrade" label="所属行业" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhTrade1" label="所属行业1" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhAcreage" label="预计展会面积" header-align="center" align="center"></el-table-column>
      <el-table-column prop="charProcess" label="联系进展" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhWebUrl" label="展会网址" header-align="center" align="center"></el-table-column>
      <el-table-column prop="intCustNumber" label="观众数量" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhRecommend" label="recommend" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhPriority" label="优先级" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhLinkInfo" label="联系信息" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhOrgInfo" label="组织信息" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhExtInfo" label="销售情况" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhCreator" label="初始信息添加人" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhSName" label="短的展会名称" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhEName" label="英文名称" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhCreateTime" label="创建时间" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhHandleTime" label="handletime" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhIfAudited" label="ifaudited" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhClickNum" label="点击数" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhNumLastMonth" label="最近一月访问次数" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhNumLastWeek" label="最近一周访问次数" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhOrder" label="此次展会在未开展会中的排名" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhZhichiNum" label="zhichinum" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhFanduiNum" label="fanduinum" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhLastExhId" label="lastexhid" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhStallNum" label="exhStallNum" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhAttend" label="exhAttend" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhSubPlace" label="exhSubPlace" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhProject" label="exhProject" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhMaxCurrentCard" label="exhMaxCurrentCard" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhParentId" label="exhParentId" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhShowRooms" label="exhShowRooms" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhIfVisit" label="exhIfVisit" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhRemark" label="exhRemark" header-align="center" align="center"></el-table-column>
      <el-table-column prop="modifierId" label="modifierId" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhOwner" label="exhOwner" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhInviteActorOjaId" label="exhInviteActorOjaId" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhEsName" label="exhEsName" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhActorManagerId" label="exhActorManagerId" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhDetailEn" label="exhDetailEn" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhMarOfficerId" label="exhMarOfficerId" header-align="center" align="center"></el-table-column>
      <el-table-column prop="code" label="code" header-align="center" align="center"></el-table-column>
      <el-table-column prop="project" label="project" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhFName" label="exhFName" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhSaleAmount" label="exhSaleAmount" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhActorCount" label="exhActorCount" header-align="center" align="center"></el-table-column>
      <el-table-column prop="exhBoothCount" label="exhBoothCount" header-align="center" align="center"></el-table-column>
      <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
        <template v-slot="scope">
          <el-button v-if="state.hasPermission('crm:crmexhibition:update')" type="primary" link @click="addOrUpdateHandle(scope.row.id)">{{ $t("update") }}</el-button>
          <el-button v-if="state.hasPermission('crm:crmexhibition:delete')" type="primary" link @click="state.deleteHandle(scope.row.id)">{{ $t("delete") }}</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination :current-page="state.page" :page-sizes="[10, 20, 50, 100]" :page-size="state.limit" :total="state.total" layout="total, sizes, prev, pager, next, jumper" @size-change="state.pageSizeChangeHandle" @current-change="state.pageCurrentChangeHandle"> </el-pagination>
    <!-- 弹窗, 新增 / 修改 -->
    <add-or-update :key="addKey" ref="addOrUpdateRef" @refreshDataList="state.getDataList"></add-or-update>
  </div>
</template>

<script lang="ts" setup>
import useView from "@/hooks/useView";
import { nextTick, reactive, ref, toRefs, watch } from "vue";
import AddOrUpdate from "./crmexhibition-add-or-update.vue";

const view = reactive({
  getDataListURL: "/crm/crmexhibition/page",
  getDataListIsPage: true,
  exportURL: "/crm/crmexhibition/export",
  deleteURL: "/crm/crmexhibition",
  deleteIsBatch: true,
  dataForm: {
    exhName: "",
    exhBTime: "",
    exhETime: "",
    exhCity: "",
  }
});

const state = reactive({ ...useView(view), ...toRefs(view) });


const addKey = ref(0);
const addOrUpdateRef = ref();
const addOrUpdateHandle = (id?: number) => {
  addKey.value++;
  nextTick(() => {
    addOrUpdateRef.value.init(id);
  });
};
</script>